﻿using System.Diagnostics;
using System.Drawing;
using Microsoft.VisualStudio.DebuggerVisualizers;

[assembly: DebuggerVisualizer(
    typeof(ImageVisualizer.ImageVisualizer),
    typeof(VisualizerObjectSource),
    Target = typeof(Image),
    Description = "Image visualizer")]
namespace ImageVisualizer
{
    
    public class ImageVisualizer:DialogDebuggerVisualizer
    {
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            using (var showImage = new ShowImage())
            {
                showImage.ImageSource = objectProvider.GetObject() as Image;
                showImage.ShowDialog();
            }
        }

        public static void TestShowVisualizer(object objectToVisualize)
        {
            var test = new VisualizerDevelopmentHost(objectToVisualize, typeof (ImageVisualizer));
            test.ShowVisualizer();
        }
    }
}
